Repository navigation
[core] Fix lookup merge buffer serialization for projected reads - #10549
Merged
JingsongLi merged 1 commit intoOct 16, 2026
Merged
Conversation
JunRuiLee
approved these changes
Oct 14, 2026
JunRuiLee
left a comment
Contributor
There was a problem hiding this comment.
LGTM, pending green CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Fix lookup merge buffer serialization when reading with a projected schema.
LookupMergeFunction.Factorycurrently creates the candidate buffer using the fullvalueType, even when the input rows follow a projectedreadType. Once the number of candidates for a key exceedslookup.merge-records-threshold, the buffer switches to binary serialization. The mismatch between the serializer schema and the actual row layout can cause read failures when fields are pruned or reordered, including nested projections.This PR uses
readTypeto derive the buffer schema when it is provided, preserving the projected field order and nested structure. Nullable fields from the internalvalueTypeare retained by matching field IDs. This preserves the delete-record handling introduced in #9978, where omitted values may be null even if the corresponding fields are declaredNOT NULLin the read schema.The original
readTypeis still passed unchanged to the wrapped merge function. Calls without areadTypecontinue to usevalueType.No public API or table file-format changes.
Tests
Added regression coverage for:
NOT NULLin the read schema.lookup.merge-records-thresholdset to 1.Validated the following test classes with JDK 8:
LookupMergeFunctionTestLookupMergeFunctionUnitTestLookupChangelogMergeFunctionWrapperTestLookupMergeTreeCompactRewriterTestPrimaryKeySimpleTableTestall tests passed, with no failures, errors, or skips.